package com.binson.consumers.appapi.factory;

import com.binson.common.core.domain.R;
import com.binson.common.model.AppModel;
import com.binson.consumers.appapi.AppPayService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RemoteAppPayFallbackFactory implements FallbackFactory<AppPayService> {
    @Override
    public AppPayService create(Throwable throwable) {
        log.error("appPayService",throwable);
        return new AppPayService() {
            @Override
            public R<?> test(AppModel appModel) {
                log.info("test 错误，异常信息{}",appModel);
                return R.fail("请求异常");
            }

            @Override
            public R<?> test2() {
                log.info("test2 错误，异常信息{}");
                return R.fail("请求异常");
            }

            @Override
            public int hashCode() {
                return super.hashCode();
            }
        };
    }
}
